package com.shoy.myapp.app;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import com.shoy.myapp.R;
import com.shoy.myapp.base.BaseActivity;
import com.shoy.myapp.ui.Login;

/**
 * 应用程序启动类：显示欢迎界面并跳转到主界面
 *
 * @author shoy
 * @created 2015/4/1
 */
public class AppStart extends BaseActivity {

    @Override
    public int bindLayout() {
        return R.layout.start;
    }

    @Override
    public void initView(View view) {
        AlphaAnimation aa = new AlphaAnimation(0.3f, 1.0f);
        aa.setDuration(3000);
        view.startAnimation(aa);
        aa.setAnimationListener(new AnimationListener() {
            @Override
            public void onAnimationEnd(Animation arg0) {
                redirectTo();
            }

            @Override
            public void onAnimationRepeat(Animation animation) {
            }

            @Override
            public void onAnimationStart(Animation animation) {
            }
        });
    }

    @Override
    public void doBusiness(Context mContext) {
    }

    /**
     * 跳转到...
     */
    private void redirectTo() {
        Intent intent = new Intent(this, Login.class);
        startActivity(intent);
        Log.d(TAG, "redirect to Login");
        finish();
    }
}
